package com.zb.zbtcommon.controller;

import com.zb.zbtcommon.dto.ResponseEntity;
import com.zb.zbtcommon.entity.Linktype;
import com.zb.zbtcommon.service.LinktypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/zbt/common/linktype",method = RequestMethod.POST)
@Api(value = "LinktypeController查询全部链接")

public class LinktypeController {
    private Logger logger= LoggerFactory.getLogger(LinktypeController.class);
    @Autowired

    private LinktypeService linktypeService;

    @RequestMapping("/findLinklist")
    @ApiOperation("查询链接")
    public ResponseEntity<Linktype> findLink(){
        ResponseEntity entity=null;

        try {
            entity=new ResponseEntity();
            List<Linktype> list=linktypeService.findLinktypeList();
            entity.setCode(HttpStatus.OK.value());
            entity.setTarget(list);
        } catch (Exception e) {
            logger.error("/zbt/common/linktype/findLinklist  请求参数：无   异常信息"+e.getMessage());
            e.printStackTrace();
            entity.setCode(HttpStatus.INTERNAL_SERVER_ERROR.value());
            entity.setMessage("查询全部**链接数据错误");
        }
        return entity;
    }
}
